<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!--360浏览器优先以webkit内核解析-->


    <title>主页</title>

    <link rel="shortcut icon" href="favicon.ico"> 
    <link href="/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="/static/admin/css/animate.css" rel="stylesheet">
    <link href="/static/admin/css/style.css?v=4.1.0" rel="stylesheet">

    <link href="/static/admin/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">

    <style>
        .table-hover>tbody>tr:hover{
            background-color: #eaeaea;
        }
        .yj-box table thead, .yj-box table tbody tr {
            display:table;
            width:100%;
            table-layout:fixed;
        }
        .yj-box table tbody::-webkit-scrollbar {
            /* display: none; */
            width: 2px;
        }
        .yj-box table tbody::-webkit-scrollbar-track{
            background-color: #ffffff;
        }
        .yj-box table {
            border:none;
        }
        .yj-box table tbody tr,.yj-box table tbody td{
            border: none;
            
        }
        .yj-box .ibox-content{
            padding: 0;
        }
    </style>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="row" >
                    <div class="col-sm-4 row-height">
                        <div class="row row-sm text-center">
                            <div class="col-xs-6">
                                <div class="panel padder-v item">
                                    <div class="h1 text-info font-thin h1" id="signing_month_count">0</div>
                                    <span class="text-muted text-xs">本月签约</span>
                                </div>
                            </div>
                            <div class="col-xs-6">
                                <div class="panel padder-v item bg-info">
                                    <div class="h1 text-fff font-thin h1" id="signing_day_count">0</div>
                                    <span class="text-muted text-xs">今日签约</span>
                                </div>
                            </div>
                            <div class="col-xs-6">
                                <div class="panel padder-v item bg-primary">
                                    <div class="h1 text-fff font-thin h1" id="zxz_count">0</div>
                                    <span class="text-muted text-xs">咨询中</span>
                                </div>
                            </div>
                            <div class="col-xs-6">
                                <div class="panel padder-v item">
                                    <div class="font-thin h1" id="cm_count">0</div>
                                    <span class="text-muted text-xs">已沉默</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-8 ">
                        <div class="ibox float-e-margins set-height yj-box">
                            <div class="ibox-content" style="border-top:none; height: 100%;">
                                <table class="table table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th>#</th>
                                            <th>咨询顾问</th>
                                            <th>主要业绩</th>
                                            <th>签约金额</th>
                                        </tr>
                                    </thead>
                                    <tbody style="overflow-y: scroll;display: inline-block;height: 210px;">
                                        {volist name='yj' id='vo'}
                                        <tr>
                                            <td>{$vo.id}</td>
                                            <td>{$vo.username}</td>
                                            <td>{$vo.zyyj}</td>
                                            <td>{$vo.qyje}</td>
                                        </tr>
                                        {/volist}
                                       
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
            <!-- <div class="col-sm-12">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title" style="border-bottom:none;background:#fff;">
                                <h5>往期数据(全部数据)</h5>
                            </div>
                            <div class="ibox-content" style="border-top:none;">
                                <div id="yesterday" style="height:217px;">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div> -->
            <div class="col-sm-12">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title" style="border-bottom:none;background:#fff;">
                                <h5>今日录入</h5>
                            </div>
                            <div class="jqGrid_wrapper">
                                <table id="table_list_1"></table>
                                <div id="pager_list_1"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-12">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title" style="border-bottom:none;background:#fff;">
                                <h5>今日回访</h5>
                            </div>
                            <div class="jqGrid_wrapper">
                                <table id="returnvisit_today"></table>
                                <div id="pager_returnvisit_today"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-12">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title" style="border-bottom:none;background:#fff;">
                                <h5>昨日未回访</h5>
                            </div>
                            <div class="jqGrid_wrapper">
                                <table id="returnvisit_yesterday"></table>
                                <div id="pager_returnvisit_yesterday"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-12">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title" style="border-bottom:none;background:#fff;">
                                <h5>今日已回访</h5>
                            </div>
                            <div style="height: 500px;overflow: auto;
                            padding: 10px 0;">
                                {foreach $returned_today as $key=>$val}
                                <div style="padding-left:15px;">
                                    <div style="color:red">{$key}:</div>
                                    <div style="padding-left:15px;">
                                        {foreach $val as $key2=>$vo}
                                        <p>{$key2+1}. 姓名: {$vo.sname}</p>
                                        {/foreach}
                                    </div>
                                </div>
                                {/foreach}
                            </div>
                            
                        </div>
                    </div>
                </div>
            </div>

            </div>
            
        </div>
    </div>
    
    <!-- 全局js -->
    <script src="/static/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/static/admin/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="/static/admin/js/plugins/layer/layer.min.js"></script>
    <!-- Flot -->
    <script src="/static/admin/js/plugins/flot/jquery.flot.js"></script>
    <script src="/static/admin/js/plugins/flot/jquery.flot.tooltip.min.js"></script>
    <script src="/static/admin/js/plugins/flot/jquery.flot.resize.js"></script>
    <script src="/static/admin/js/plugins/flot/jquery.flot.pie.js"></script>
    <!-- 自定义js -->
    <!-- Peity -->
    <script src="/static/admin/js/plugins/peity/jquery.peity.min.js"></script>

    <!-- jqGrid -->
    <script src="/static/admin/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
    <script src="/static/admin/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>

    <script src="/static/admin/js/content.js"></script>
    <script type="text/javascript">
   
    $(function () {
        $('.set-height').height($('.row-height').height() - 20);

        function euroFormatter(v, axis) {
            return "&yen;" + v.toFixed(axis.tickDecimals);
        }

    //     var pastData = JSON.parse(''); //往期数据
    //     function doPlot(position) {
    //         $.plot($("#yesterday"), [{
    //             data: pastData.cm,
    //             label: "沉默"
    //         }, {
    //             data: pastData.signing,
    //             label: "签约",
    //             yaxis: 2
    //         }], {
    //             xaxes: [{
    //                 mode: 'time',
    //                 minTickSize: [1, "month"],
    //                 timeFormat: "%y-%0m-%0d"
    //             }],
    //             yaxes: [{
    //                 min: 0
    //             }, {
    //                 alignTicksWithAxis: position == "right" ? 1 : null,
    //                 position: position,
    //                 // tickFormatter: euroFormatter
    //             }],
    //             legend: {
    //                 position: 'sw'
    //             },
    //             colors: ["#f7f9fb"],
    //             grid: {
    //                 color: "#999999",
    //                 hoverable: true,
    //                 clickable: true,
    //                 tickColor: "#f7f9fb",
    //                 borderWidth: 0,
    //                 hoverable: true

    //             },
    //             tooltip: true,
    //             tooltipOpts: {
    //                 content: "%s %x 为 %y",
    //                 xDateFormat: "%y-%m-%0d",

    //                 onHover: function (flotItem, $tooltipEl) {
    //                     // console.log(flotItem, $tooltipEl);
    //                 }
    //             }
    //         });
    //     }

    //     doPlot("right");
        
    //     $("button").click(function () {
    //         doPlot($(this).text());
    //     });
    });


    $(document).ready(function () {

        $.jgrid.defaults.styleUI = 'Bootstrap';
        // Examle data for jqGrid
        
        var enter_today = {}; //今日添加的资源
        var returnvisit_yesterday = JSON.parse('{$returnvisit_yesterday}');
        var returnvisit_today = JSON.parse('{$returnvisit_today}');

        

        //昨日应该回访但未回访
        $("#returnvisit_yesterday").jqGrid({
            data: returnvisit_yesterday,
            datatype: "local",
            height: 250,
            autowidth: true,
            shrinkToFit: true,
            rowNum: 14,
            rowList: [10, 20, 30],
            colNames: ['序号', '学生姓名', '咨询顾问', '咨询形式', '信息来源', '来源明细'],
            colModel: [
                {
                    name: 'sid',
                    index: 'sid',
                    width: 60,
                    align: "center",
                    sorttype: "int"
                },
                {
                    name: 'sname',
                    index: 'sname',
                    align: "center",
                    width: 100
                },
                {
                    name: 'consultant_name',
                    index: 'consultant_name',
                    align: "center",
                    width: 100
                },
                {
                    name: 'zx_form',
                    index: 'zx_form',
                    width: 80,
                    align: "center",
                },
                {
                    name: 'infosource',
                    index: 'infosource',
                    width: 80,
                    align: "center",
                    
                },
                {
                    name: 'source_details',
                    index: 'source_details',
                    align: "center",
                    
                }
            ],
            pager: "#pager_returnvisit_yesterday",
            viewrecords: true,
            caption: false,
            // add: true,
            // edit: true,
            // addtext: 'Add',
            // edittext: 'Edit',
            hidegrid: false,
            
        });
            // Add selection
            $("#returnvisit_yesterday").setSelection(4, true);


            // Setup buttons
            $("#returnvisit_yesterday").jqGrid('navGrid', '#pager_returnvisit_yesterday', {
                edit: false,
                add: false,
                del: false,
                search: true
            }, {
                height: 200,
                reloadAfterSubmit: true
            });

        //今日回访
        $("#returnvisit_today").jqGrid({
            data: returnvisit_today,
            datatype: "local",
            height: 250,
            autowidth: true,
            shrinkToFit: true,
            rowNum: 14,
            rowList: [10, 20, 30],
            colNames: ['序号', '学生姓名', '咨询顾问', '咨询形式', '信息来源', '来源明细'],
            colModel: [
                {
                    name: 'sid',
                    index: 'sid',
                    width: 60,
                    align: "center",
                    sorttype: "int"
                },
                {
                    name: 'sname',
                    index: 'sname',
                    align: "center",
                    width: 100
                },
                {
                    name: 'consultant_name',
                    index: 'consultant_name',
                    align: "center",
                    width: 100
                },
                {
                    name: 'zx_form',
                    index: 'zx_form',
                    width: 80,
                    align: "center",
                },
                {
                    name: 'infosource',
                    index: 'infosource',
                    width: 80,
                    align: "center",
                    
                },
                {
                    name: 'source_details',
                    index: 'source_details',
                    align: "center",
                    
                }
            ],
            pager: "#pager_returnvisit_today",
            viewrecords: true,
            caption: false,
            // add: true,
            // edit: true,
            // addtext: 'Add',
            // edittext: 'Edit',
            hidegrid: false,
            
        });
            // Add selection
            $("#returnvisit_today").setSelection(4, true);


            // Setup buttons
            $("#returnvisit_today").jqGrid('navGrid', '#pager_returnvisit_today', {
                edit: false,
                add: false,
                del: false,
                search: true
            }, {
                height: 200,
                reloadAfterSubmit: true
            });



            let url = "{:url('Home/index')}";
            var pastData = {};
            $.ajax({
                url:url,
                type:'get',
                data:{type:'status_count'},
                success:function(res){
                    let data = JSON.parse(res);
                    $("#cm_count").text(data.cm_count);
                    $("#zxz_count").text(data.zxz_count);
                    $("#signing_day_count").text(data.signing_day_count);
                    $("#signing_month_count").text(data.signing_month_count);
                }
            });
            $.ajax({
                url:url,
                type:'get',
                data:{type:'enter_today'},
                success:function(res){
                    enter_today = JSON.parse(res);
                    //今日添加的资源
                    $("#table_list_1").jqGrid({
                        data: enter_today,
                        datatype: "local",
                        height: 250,
                        autowidth: true,
                        shrinkToFit: true,
                        rowNum: 14,
                        rowList: [10, 20, 30],
                        colNames: ['序号', '学生姓名', '咨询形式', '信息来源', '来源明细'],
                        colModel: [
                            {
                                name: 'sid',
                                index: 'sid',
                                width: 60,
                                align: "center",
                                sorttype: "int"
                            },
                            {
                                name: 'sname',
                                index: 'sname',
                                align: "center",
                                width: 100
                            },
                            {
                                name: 'zx_form',
                                index: 'zx_form',
                                width: 80,
                                align: "center",
                            },
                            {
                                name: 'infosource',
                                index: 'infosource',
                                width: 80,
                                align: "center",
                                
                            },
                            {
                                name: 'source_details',
                                index: 'source_details',
                                align: "center",
                                
                            }
                        ],
                        pager: "#pager_list_1",
                        viewrecords: true,
                        caption: false,
                        // add: true,
                        // edit: true,
                        // addtext: 'Add',
                        // edittext: 'Edit',
                        hidegrid: false,
                        
                    });
                        // Add selection
                        $("#table_list_1").setSelection(4, true);


                        // Setup buttons
                        $("#table_list_1").jqGrid('navGrid', '#pager_list_1', {
                            edit: false,
                            add: false,
                            del: false,
                            search: true
                        }, {
                            height: 200,
                            reloadAfterSubmit: true
                        });

                            }
                        });

    });

  

    // Add responsive to jqGrid
    $(window).bind('resize', function () {
        var width = $('.jqGrid_wrapper').width();
        $('#table_list_1').setGridWidth(width);
        $('#returnvisit_yesterday').setGridWidth(width);
    });


    </script>
</body>

</html>
